* README 
* Replication files for
* "Capital Reallocation and the Cyclicality of Aggregate Productivity" by Russ Cooper & Immo Schott
* Prepared: May 2023
* The authors used Matlab R2023a and Stata 15 to produce the results in the paper.

The folder that contains this README.txt file also contains the following folders and subfolders:

- FIGURES
	- Figures_code
	- Figures_data
- TABLES
	- Tables_code
	- Tables_data
- MATLAB
- DATA
	- Data setup
	

OVERVIEW:

The folders FIGURES and TABLES contain all files which are necessary to replicate the figures and tables in the paper.
To replicate a table or figure, go to the subdirectory TABLES_CODE or FIGURES_CODE and select the Master file. There is one Master file for the figures and tables produced by Stata and one Master file for the figures and tables produced in Matlab. 

Inside the respective Master file, you are asked to specify a working directory. Once this is done, the desired figure or table can be generated. 

The data used throughout the paper is in the DATA folder. The subdirectory DATA_SETUP contains a Master do file that explains how the dataset used throughout the paper can be constructed. 

Note that Compustat is a proprietary dataset. We therefore only provide aggregated Compustat data, which is sufficient to generate the results. Documentation for Compustat is available at https://wrds-web.wharton.upenn.edu/wrds/support/Data.

To replicate the quantitative results of the model, go to the MATLAB folder. The main file is entitled "MAIN_coopimmo_replication.m". The code generates the Matlab output that is saved in the TABLES_DATA and FIGURES_DATA subdirectories. Those files are then loaded as part of the FIGURES and TABLES Master files. 



DETAILED OVERVIEW: 


FIGURES:
Go to FIGURES / FIGURES_CODE 
The Stata figures can be reproduced with MASTER_FIGURES.do
The Matlab figures can be reproduced with MASTER_FIGURES.m

TABLES:
Go to TABLES / TABLES_CODE 
The Stata tables can be reproduced with MASTER_TABLES.do
The Matlab tables can be reproduced with MASTER_TABLES.m

DATA:
All the data necessary to replicate the figures and tables is provided inside the TABLES_DATA and FIGURES_DATA 
Go to DATA / DATA_SETUP
Open MASTER_datasetup.do
Note that the data used in the paper was last updated in August 2019. 

MATLAB CODES:
Go to the folder MATLAB 
Open MAIN_coopimmo_replication.M
- Change the working directory if prompted.
- Runtime of the code is not significant.
- All .csv files are saved in the FIGURES and TABLES subdirectories. 		


LIST OF REQUIRED Stata PACKAGES:
- Some packages might not be previously installed on your local Stata distribution.
- You can use the following commands to install any missing packages.

ssc install freduse
ssc install reghdfe





